/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package wakawakathistimeforafrica.tools;

import wakawakathistimeforafrica.model.Client;
import weka.classifiers.Classifier;
import weka.classifiers.Evaluation;
import weka.classifiers.trees.J48;
import weka.core.Instance;
import weka.core.Instances;

/**
 *
 * @author Jissay
 */
public class ModelRequester {
    
    private Classifier cModel;
    private Instances dataSet;
    private Instances t_dataSet;
    
    /**
     * Constructor
     * @param cl 
     */
    public ModelRequester(Classifier cl, Instances dataSet) {
        this.cModel = cl;
        this.dataSet = dataSet;
    }
    
    public double requestModelForInstance(Instance inst, Instances dataSet) throws Exception {
        J48 classifier = new J48();
        classifier.buildClassifier(dataSet);        
        
        double ret = classifier.classifyInstance(inst);
        
        // Predict attribute "class" value from a built instance
//        
//        Evaluation eval = new Evaluation(this.dataSet);
//        eval.evaluateModel(this.cModel, this.t_dataSet);
//        
//        System.out.println("RESULTS :: " + eval.toSummaryString());
//        
        return ret;
    }
}
